package com.frame.work.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.frame.work.entity.TblDevice;
import com.frame.work.entity.TblDeviceActions;
import com.frame.work.entity.relation.BeijingYingYue;
import com.frame.work.entity.relation.TblGateWayHomeUserMessage;
import com.frame.work.entity.relation.TblZigbeeAndGateway;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author wjming
 */
@Mapper
public interface TblDeviceMapper extends BaseMapper<TblDevice> {
    /**
     * 查询zigbee设备信息
     *
     * @param deviceMac
     * @param od_index
     * @param device_type
     * @param product_type_02
     * @param product_type_03
     * @return
     */
    List<TblDeviceActions> selectByZigbeeMac(@Param("deviceMac") String deviceMac, @Param("od_index") String od_index, @Param("device_type") String device_type, @Param("product_type_02") String product_type_02, @Param("product_type_03") String product_type_03);

    /**
     * 查询zigbee网关和家庭信息
     *
     * @param gatewayMac
     * @return
     */
    TblGateWayHomeUserMessage selectZigbeeGatewayAndHome(@RequestParam(value = "gatewayMac") String gatewayMac);

    /**
     * 查询设备个网关信息通过mac地址
     *
     * @param queryWrapper
     * @return
     */
    TblZigbeeAndGateway selectOneByMac(@Param(Constants.WRAPPER) QueryWrapper<TblDevice> queryWrapper);

    /**
     * 查询设备的背景音乐器
     *
     * @param zigbeeMac
     * @return
     */
    BeijingYingYue selectDeviceBejingYingYue(@RequestParam(value = "zigbeeMac") String zigbeeMac);

    /**
     * 查询设备Action信息
     *
     * @param deviceMac
     * @param odIndex
     * @param deviceType
     * @param productType
     * @return
     */
    List<TblDeviceActions> selectActionByDeviceMessage(@Param("zigbeeMac") String deviceMac, @Param("odIndex") String odIndex,
                                                       @Param("deviceType") String deviceType, @Param("productType") String productType);
}